#pragma once

#include "kinect3ddata_global.h"
#include "DataAnalysis.h"
class KINECT3DDATA_EXPORT Kinect3DData :public QObject
{
	Q_OBJECT
public:
	enum emState
	{
		STATE_WAIT_START=0,
		STATE_IN_CHECK,
		STATE_IN_CAL_MESH,
		STATE_CHECK_END
	};

public:
	Kinect3DData();
	void ReStart();
	void Start();

	void PrepareReStarDataCollect();

	void Stop();

	bool GetCurrentData(DataAnalysis::suResData&data, bool isRemove = true);

	//QString GetFaceInfo();

	shared_ptr<pcl::PolygonMesh> GetFinalMesh();

	emState GetState();

signals:
	void sign_FaceCollectEnd();
	void sign_ResDataArrived();
	void sign_NeedReStart();
	void sign_StateChange(int state);
	void sign_FaceStateChange(int state,  float fEndTime);
	void sign_Kinect3DData_CalMeshFinal();
	void sign_Kinect3DData_ProgressChange(float fNewProgressValue, QString strInfo);
protected slots:
void FaceStateChange(int state, float fEndTime);

	void FaceCollectEnd()
	{
		emit sign_FaceCollectEnd();
	}
	void ProgressChange(float fNewProgressValue, QString strInfo)
	{
		emit sign_Kinect3DData_ProgressChange(fNewProgressValue, strInfo);
	}
void CalMeshFinal();
void DataArrived();
protected:
	void UpdateState(emState stateNew)
	{
		m_state = stateNew;
		emit sign_StateChange(m_state);
	}
private:
	emState m_state;
	DataAnalysis m_Analysis;
};
